import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JOptionPane;
import javax.swing.JButton;

public class user extends JFrame {

	
	private JLabel item1;
	private JLabel item2;
	private JLabel item3;
	private JLabel item4;
	private JTextField text1;
	private JTextField text2;
	private JTextField text3;
	private JTextField text4;
	private JButton enter;
	private JButton clear;
	public user(){
		super(".ICS File Creator");
		setLayout(new FlowLayout());
		
		item1 = new JLabel("Event Name");
		item1.setToolTipText("required");
		add(item1);
		text1 = new JTextField ("Enter text here");
		add(text1);
		item2 = new JLabel("Location");
		item2.setToolTipText("required");
		add(item2);
		text2 = new JTextField ("Enter text here");
		add(text2);
		item3 = new JLabel("Start Time/date");
		item3.setToolTipText("required");
		add(item3);
		text3= new JTextField ("End Time/date");
		add(text3);
		item4 = new JLabel("Resouces");
		item4.setToolTipText("required");
		add(item4);
		text4 = new JTextField ("Enter text here");
		add(text4);
		enter = new JButton("Enter");
		add(enter);
		clear = new JButton("Clear");
		add(clear);
		
		thehandler handler = new thehandler();
	    text1.addActionListener(handler);
	    text2.addActionListener(handler);
	    text3.addActionListener(handler);
	    text4.addActionListener(handler);
	    enter.addActionListener(handler);
	}
	
	private  class thehandler implements ActionListener{
		
		public void actionPerformed(ActionEvent event){
			
			String string ="";
			
			
			if(event.getSource()==text1)
			string = String.format("Event: %s",event.getActionCommand());
			
			else if(event.getSource()==text2)
				string = String.format("Event2: %s",event.getActionCommand());
			
			else if(event.getSource()==text3)
				string = String.format("Event3: %s",event.getActionCommand());
			
			else if(event.getSource()==text4)
				string = String.format("Event4: %s",event.getActionCommand());
			else if(event.getSource()==enter)
			 string = string.format("all this entered: %s ", event.getActionCommand());
			JOptionPane.showMessageDialog(null,string);
		}

		
	}
	
}
